home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Libris Britannia 4
/
science library(b).zip
/
science library(b)
/
PROGRAMM
/
DB_CLIPP
/
2614.ZIP
/
TBROWS.ZIP
/
TTBR3.PRG
< prev
next >
Wrap
Text File
|
1990-10-22
|
3KB
|
133 lines
/*****
*
* TTBR3.PRG
* Third example for TBROWSE class using a database file
*
* 19 October 90
* Luiz Quintela - Nantucket Corp
*
* Clipper ttbr3 /N/W/A/B
* RTLINK FILE ttbr3 PLL base50
*
*/
// Include Header Files
#include "inkey.ch"
FUNCTION Main()
LOCAL b, column, nKey
SET SCOREBOARD OFF
SET DATE BRITISH
SET CONFIRM ON
USE test INDEX test NEW
SETCOLOR( "BG/B,GR+/B,,,BG/N" ); CLS
b := TBrowseDB( 2, 2, 20, 48)
b:colSep := " │ "
b:headSep := "═╤═"
// Include a footer separator character
// using an instance variable named footSep
b:footSep := "═══"
// TBColumn objects
column := TBColumnNew( "Field 1", {|| test->fld1} )
// Now you will use the instance variable column:footing to
// tell user this is the first column in the browse display
column:footing := "First"
b:addColumn( column )
column := TBColumnNew( "Field 2", {|| test->fld2} )
b:addColumn( column )
column := TBColumnNew( "Field 3", {|| test->fld3} )
b:addColumn( column )
column := TBColumnNew( "Field 4", {|| test->fld4} )
b:addColumn( column )
column := TBColumnNew( "Field 5", {|| test->fld5} )
column:footing := "Last"
b:addColumn( column )
WHILE .T.
// Stabilization
WHILE ( !b:stabilize() )
nKey := InKey()
IF ( nKey != 0 )
EXIT // abort if a key is waiting
ENDIF
END
IF ( b:stable )
// Is always a good idea tell the user about end or
// beginning of file
// b:hitTop contais a .T. if an attempt was made
// to navigate beyond the beginning of data source
// b:hitBottom contais a .T. if an attempt was made
// to navigate beyond the end of data source
IF ( b:hitTop .OR. b:hitBottom )
TONE(87.3,1)
TONE(40,3.5)
ENDIF
// everything's done; just wait for a key
nKey := INKEY(0)
ENDIF
// Process key
IF ( nKey == K_DOWN )
b:down()
ELSEIF ( nKey == K_UP )
b:up()
ELSEIF ( nKey == K_PGDN )
b:pageDown()
ELSEIF ( nKey == K_PGUP )
b:pageUp()
ELSEIF ( nKey == K_CTRL_PGUP )
b:goTop()
ELSEIF ( nKey == K_CTRL_PGDN )
b:goBottom()
ELSEIF ( nKey == K_RIGHT )
b:right()
ELSEIF ( nKey == K_LEFT )
b:left()
ELSEIF ( nKey == K_HOME )
b:home()
ELSEIF ( nKey == K_END )
b:end()
ELSEIF ( nKey == K_CTRL_LEFT )
b:panLeft()
ELSEIF ( nKey == K_CTRL_RIGHT )
b:panRight()
ELSEIF ( nKey == K_CTRL_HOME )
b:panHome()
ELSEIF ( nKey == K_CTRL_END )
b:panEnd()
ELSEIF ( nKey == K_ESC )
CLS; QUIT
ENDIF
END
/* EOF - TTBR3.PRG */